import {request} from '@/utils/request'

const apiUrl = '/api/v1/dev/'

export function list(id) {
  return request({
    url: `${apiUrl}list/${id}`,
    method: 'get'
  })
}

//设置设备属性
export function setProperty(data) {
  return request({
    url: `${apiUrl}SetProperty`,
    method: 'post',
    data
  })
}

//删除设备
export function del(id) {
  return request({
    url: apiUrl + id,
    method: 'delete'
  })
}

//查询设备所有属性
export function getProperty(devCode) {
  return request({
    url: `${apiUrl}value`,
    method: 'get',
    params: {
      devCode: devCode,
    }
  })
}

//查询设备属性值(取ICCID)
export function getIcc(devCode, fieldName="") {
  return request({
    url: `${apiUrl}value`,
    method: 'get',
    params: {
      devCode: devCode,
      fieldName: fieldName
    }
  })
}

//流量查询
export function cardGprs(devCode) {
  return request({
    url: `${apiUrl}queryCardInfo`,
    method: 'get',
    params: {
      devCode
    }
  })
}

//修改设备属性
export function changeProperty(data) {
  return request({
    url: `${apiUrl}privateModel`,
    method: 'put',
    data
  })
}

//用户所有设备
export function listAll() {
  return request({
    url: `${apiUrl}getAllDev`,
    method: 'get'
  })
}


